﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufBase.h"
#include "GnufUiCommonDef.h"

class QWidget;

namespace gnuf {
    
    class ErrorMessageImpl;
    class GNUF_BASE_EXPORT ErrorMessage
    {
    public:
        explicit ErrorMessage();
        ~ErrorMessage();
        
        ///\brief Set the icon type.
        void setIcon(const EIcon);
        ///\brief Set the icon.
        void setIcon(const std::wstring & val)  { m_icon = val; }
        ///\return Return the icon.
        const std::wstring & icon() const       { return m_icon; }
        
        ///\brief Set the text.
        void setText(const std::wstring & val)  { m_text = val; }
        ///\return Return the text.
        const std::wstring & text() const       { return m_text; }
        
        ///\brief Show around the { globalX, globalY, width, height } at the placement.
        void showAround(int globalX, int globalY, int width, int height,
                        gnuf::EPlacement placement);
        
        ///\brief Show around the pQtWgt at the placement.
        void showAround(const QWidget * pQtWgt, gnuf::EPlacement placement);
        
        ///\brief Hide.
        void hide();
        
        ///\return Return true if visible.
        bool isVisible() const;
        
    private:
        gcmp::OwnerPtr< ErrorMessageImpl > m_opImpl;
        std::wstring m_icon;
        std::wstring m_text;
    };
    
}